 <?php
class UsersControllerTest extends CakeTestCase {
	function startCase() {
		echo '<h2>Starting Test Case</h2>';
	}
	
	function endCase() {
		echo '<h2>Ending Test Case</h2>';
	}
	
	function startTest($method) {
		echo '<h5>Starting method ' . $method . '</h5>';
	}
	
	function testRegisterDisable() {
		Configure::write('User.useRegister', FALSE);
		$result = $this->testAction('/users/register');
		$this->assertEqual(1, $result['code']);
	}
	
	function testRegisterDisplay() {
		Configure::write('User.useRegister', TRUE);
		$result = $this->testAction('/users/register');
		$this->assertEqual(2, $result['code']);
	}
	
	function testRegisterOk() {
		Configure::write('User.useRegister', TRUE);
		$data = array(
			'Article' => array(
				'user_id' => 1, 
				'published' => 2 
			)
		);
		$result = $this->testAction('/users/register', array('data' => $data, 'method' => 'post'));
		pr($result);
		
		$this->assertEqual(4, $result['code']);
		$this->assertEqual('Username should be between 3 and 50 chars.', $result['data']['username']);
		$this->assertEqual(4, $result['data']['password']);
		$this->assertEqual(4, $result['data']['email']);
	}
}
?>
